<template>
  <div class="payorder">
    <div v-if="code === 2">
      <img src="../../assets/img/success.png"
           alt="">
      <div class="payorder_txt">
        绑定成功
      </div>
    </div>
    <div v-else>
      <img src="../../assets/img/fail.png"
           alt="">
      <div class="payorder_txt">
        绑定失败
      </div>
    </div>
    <van-button class="payorder_but"
                size="small"
                round
                block
                type="info"
                native-type="onSubmit"
                @click="noBack">返回
    </van-button>
  </div>
</template>
<script>
export default {

  data () {
    return {
      code: 0
    };
  },
  created () {
    this.code = Number(this.$route.query.code)
  },
  methods: {
    noBack () {
      if (this.code === 2) {
        document.title = '绑定成功'
      } else {
        document.title = '绑定失败'
      }
    }
  }
};
</script>
<style lang='less' scoped>
.payorder {
  background: #f9f9f9;
  padding-top: 40%;
  height: 100%;
  img {
    width: 150px;
    height: 150px;
    margin: 0 auto;
    display: block;
  }
  .payorder_txt {
    font-size: 34px;
    font-family: 'PingFang SC';
    font-weight: 400;
    color: #131313;
    margin: 50px auto;
    text-align: center;
  }
  .payorder_but {
    width: 80%;
    height: 80px;
    background: #ffb72f;
    border: #ffb72f;
    border-radius: 40px;
    margin: auto;
    margin-top: 40px;
    font-size: 30px;
    position: absolute;
    bottom: 364px;
    left: 0;
    right: 0;
  }
}
</style>